package com.jijs.cxf.calc.client;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import com.jijs.cxf.calc.client.interceptor.LicenseUserOutInter;


public class CXFClient {
	
	
	
	public static void test(){
		ICalcWsService cws = new CalcWsService().getCalcWsPort();
		int result = cws.add(22, 78);
		System.out.println(result);
	}
	
	public static void test2(){
		JaxWsProxyFactoryBean fac = new JaxWsProxyFactoryBean();
		fac.setServiceClass(ICalcWsService.class);
		fac.setAddress("http://localhost:8080/ms");
		fac.getInInterceptors().add(new LoggingInInterceptor());
		fac.getOutInterceptors().add(new LoggingOutInterceptor());
		fac.getOutInterceptors().add(new LicenseUserOutInter());
		ICalcWsService cws=(ICalcWsService)fac.create();
		System.out.println(cws.add(22, 78));
	}

	public static void main(String[] args) {
		test2();
	}
}
